package operation.impl;

import book.Book;
import book.BookList;
import operation.IOperation;

/**
 * 退出系统
 */
public class ExitOperation implements IOperation {
    @Override
    public void work(BookList bookList) {
        System.out.println("退出系统！");
        //遍历将每本书都置为null
        for (int i = 0; i < bookList.getUsedSize(); i++) {
            bookList.setBook(i,null);
        }
        bookList.setUsedSize(0);
        System.exit(0);  //退出程序
    }
}
